package android.bkav.testing.utils;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseNoteHelper extends SQLiteOpenHelper {
	
	private static final String DATABASE_NAME = "Note_Database";
	private static final int DATABASE_VERSION = 1;
	
	private static final String DATABASE_CREATE = "create table dbnotes (_id integer primary key autoincrement," + "note_title text, note_content text not null, date_time text not null);";
	
	public DatabaseNoteHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL(DATABASE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		Log.w(DatabaseNoteHelper.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data");
		db.execSQL("DROP TABLE IF EXITS todo");
		onCreate(db);
	}

}
